<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>发表评论</title>

		<link href="/Public/one/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="/Public/one/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="/Public/one/css/personal.css" rel="stylesheet" type="text/css">
		<link href="/Public/one/css/appstyle.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="/Public/one/js/jquery-1.7.2.min.js"></script>
	</head>

	<body>
		<!--头 -->
		<header>
			<article>
				<div class="mt-logo">
					<!--顶部导航条 -->
					<include file="Public/tpl/hometop.html"/>
					</div>
				</div>
			</article>
		</header>
            <div class="nav-table">
					   <div class="long-title"><span class="all-goods">全部分类</span></div>
					   <div class="nav-cont">
							<ul>
								<li class="index"><a href="#">首页</a></li>
                                <li class="qc"><a href="#">闪购</a></li>
                                <li class="qc"><a href="#">限时抢</a></li>
                                <li class="qc"><a href="#">团购</a></li>
                                <li class="qc last"><a href="#">大包装</a></li>
							</ul>
						    <div class="nav-extra">
						    	<i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
						    	<i class="am-icon-angle-right" style="padding-left: 10px;"></i>
						    </div>
						</div>
			</div>
			<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-comment">
						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">发表评论</strong> / <small>Make&nbsp;Comments</small></div>
						</div>
						<hr/>

						<div class="comment-main">
													
															
					<script type="text/javascript">
						function flowComment(){
							$(document).ready(function() {
								$(".comment-list .item-opinion li").click(function() {	
									$(this).prevAll().children('i').removeClass("active");
									$(this).nextAll().children('i').removeClass("active");
									$(this).children('i').addClass("active");
									
								});
					     	})
				     	}
					</script>					
					
												
							
						</div>

					</div>

				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">恒望科技</a>
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">关于恒望</a>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有</em>
						</p>
					</div>
				</div>
			</div>

			<include file="Public/tpl/homeleft.html"/>
		</div>
	<script type="text/html" id="sendComment">
		<%for(var i=0;i<data.length;i++){%>
		<div class="item12">
			<div class="comment-list" alt="<%=data[i].pid%>" time="<%=data[i].time%>" oid="<%=data[i].id%>">
				<div class="item-pic">
					<a href="#" class="J_MakePoint">
						<img src="<%=data[i].images%>" class="itempic">
					</a>
				</div>

				<div class="item-title">

					<div class="item-name">
						<a href="#">
							<p class="item-basic-info"><%=data[i].name%></p>
						</a>
					</div>
					<div class="item-info">
						<div class="info-little">
						<%var property=data[i].property%>
						<%for(var j=0;j<property.length;j++){%>
							<span><%=property[j]%></span>
						<%}%>	
						</div>
						
						<div class="item-price">
							价格：<strong><%=data[i].price%>元</strong>
						</div>
					</div>
				</div>
				<div class="clear"></div>
				<div class="item-comment">
					<textarea placeholder="请写下对宝贝的感受吧，对他人帮助很大哦！" class="content"></textarea>
				</div>
				<div class="filePic">
					<input type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*" >
					<span>晒照片(0/5)</span>
					<img src="<%=data[i].images%>" alt="">
				</div>
				<div class="item-opinion">
					<li><i class="op1"></i>好评</li>
					<li><i class="op2"></i>中评</li>
					<li><i class="op3"></i>差评</li>
				</div>

			</div>
		
		</div>
		<%}%>

	</script>
	<script type="text/html" id="sendComment2">
			<div>
			<div class="comment-list">
								<div class="item-pic">
									<a href="#" class="J_MakePoint">
										<img src="/Public/one/images/comment.jpg_400x400.jpg" class="itempic">
									</a>
								</div>

								<div class="item-title">

									<div class="item-name">
										<a href="#">
											<p class="item-basic-info">美康粉黛醉美唇膏 持久保湿滋润防水不掉色</p>
										</a>
									</div>
									<div class="item-info">
										<div class="info-little">
											<span>颜色：洛阳牡丹</span>
											<span>包装：裸装</span>
										</div>
										<div class="item-price">
											价格：<strong>19.88元</strong>
										</div>
									</div>
								</div>
								<div class="clear"></div>
								<div class="item-comment">
									<textarea placeholder="请写下对宝贝的感受吧，对他人帮助很大哦！"></textarea>
								</div>
								<div class="filePic">
									<input type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*" >
									<span>晒照片(0/5)</span>
									<img src="/Public/one/images/image.jpg" alt="">
								</div>
								<div class="item-opinion">
									<li><i class="op1"></i>好评</li>
									<li><i class="op2"></i>中评</li>
									<li><i class="op3"></i>差评</li>
								</div>
							</div>

					</div>





	</script>
	<script src="/Public/js/template-native.js"></script>
	<script type="text/javascript">
		function weitcomment(){
			var time="{$time}";
			$.get('/Api/Index/getComment',{'time':time},function(ret){
				if (ret.status==true) {
					var html=template('sendComment',ret);
					$('.comment-main').html("");
					$('.comment-main').append(html);
					saveComment();
					flowComment();
				}else{
					$('.comment-main').html("");
				}
				
			})
		}
		weitcomment();
		function saveComment(){
			$('.comment-list').each(function(){
				$(this).click(function(){
					var html='<div class="info-btn"><div class="am-btn am-btn-danger">发表评论</div></div>';
					$(this).parents('.comment-main').find('.info-btn').remove();
					$(this).closest('.item12').append(html);
					commentClick();
				})
			})
		}
		function commentClick(){
			$('.info-btn').click(function(){
				var grad=$(this).closest('.item12').find('.active').parent().text();
				var content=$(this).closest('.item12').find('.content').val();
				var buytime=$(this).closest('.item12').find('.comment-list').attr('time');
				var pid=$(this).closest('.item12').find('.comment-list').attr('alt');
				var oid=$(this).closest('.item12').find('.comment-list').attr('oid');;
				if (grad==false) {alert('请选择评价');return};
				if (content==false) {alert('请输入对商品的评价');return}
				var param={};
				param.grad=grad;
				param.content=content;
				param.buytime=buytime;
				param.pid=pid;
				param.oid=oid;
				$.post('/Api/Index/addComment',param,function(ret){
						if (ret!=false) {
							alert("添加评论成功");
							weitcomment()
						}
				})
				
			})
		}
	</script>
	</body>

</html>